﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Weight.Dal.Contract;
using Weight.Model;
using Weight.Model.ParamEntity;

namespace Weight.Bll.Contract
{
    public  class BllContractRecharge
    {
        /// <summary>
        /// 充值dal层
        /// </summary>
        private DalContractRecharge Dal = new DalContractRecharge();

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Tuple<bool,string> Add(ContractTicketRechargeEntity entity)
        {
            if(entity == null)
            {
                return new Tuple<bool, string>(false,"参数错误");
            }
            else
            {
                if( Dal.Add(entity))
                {
                    return new Tuple<bool, string>(true,"添加成功");
                }
                else
                {
                    return new Tuple<bool, string>(false, "添加失败");
                }

            }
        }

        /// <summary>
        /// 查询充值记录
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public List<ContractTicketRechargeEntity> List(QueryContractChargeReq req)
        {
            if (req == null || string.IsNullOrEmpty( req.TicketId)) new List<ContractTicketRechargeEntity>();
            return Dal.List(req).ToList() ;
        }

    }
}
